import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from "@vitejs/plugin-vue-jsx";
import { resolve } from 'path';

export default defineConfig({
    base:"./",         
    plugins: [vue(), vueJsx()],
    resolve: {
        alias: {
            "@": resolve(__dirname, "src"),
            "comp": resolve(__dirname, "src/components"),
            "/img": "./src/assets"
        },
        extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'], 
    },
    css: {
        preprocessorOptions: {
            scss: {
                additionalData: '@import "@/styles/global.scss";'
            }
        }
    },
    build: {
        emptyOutDir: true, 
        outDir: 'dist',
        assetsDir: 'assets',
        minify: 'terser', 
        terserOptions: {
            compress: {
                drop_console: true,
                drop_debugger: true
            }
        }
    },
    server: {
        host: "0.0.0.0",
        port: "8888",
        cors: true, 
        https: false, 
        open: true, 
        hmr: true,
        strictPort: false, 
        proxy: {
            "/api": {
                target: "https://admin.itrustnow.com",
                changeOrigin: true,
                rewrite: path => path.replace(/^\/api/, ""),
            }
        }
    }
    
})
